home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17537 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.mira.net.au!news
  2. From: davidw@werple.net.au (David White)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Pure virtual destructors?
  5. Date: 16 Apr 1996 20:32:11 +1000
  6. Organization: Werple Internet, Melbourne
  7. Message-ID: <4kvsvb$bf@werple.net.au>
  8. References: <4kuq0i$p6t@ftp.ee.vill.edu>
  9. NNTP-Posting-Host: werplez.mira.net.au
  10.  
  11. sheridan@monet.vill.edu writes:
  12.  
  13.  
  14. >The rule with destructors is that they are always overridden, right?
  15. >That's a quote from VC4 docs, BTW.  When I do this:
  16.  
  17. >class CBase {
  18. >public:
  19. >    virtual ~CBase() = 0;
  20. >...};
  21.  
  22. >class CChild : public CBase {
  23. >public:
  24. >    ~CChild();
  25. >...};
  26.  
  27. >and declare a body for ~CChild, I always get unresolved external on
  28. >CBase::~CBase.  I have seen this in several cases.  My guess is it's not
  29. >a compiler bug, so what am I missing?
  30.  
  31. >Thanks.
  32. >Pete Sheridan
  33.  
  34. When a virtual function is declared pure, it doesn't necessarily mean that
  35. the class doesn't implement the function, it means only that some derived
  36. class must implement it. You are free to provide an implementation for any
  37. pure virtual function. In the case of virtual destructors, you have to
  38. provide an implementation whether you declare it pure or not.
  39.  
  40. David White
  41. davidw@werple.mira.net.au
  42.  
  43.  
  44.